#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

static const char* pathName = "./test.txt";

class NamedPipe
{
public:
    static void CreatePipe()
    {
        static NamedPipe nm;
    }
private:
    NamedPipe()
    {
        int n = ::mkfifo(pathName, 0666);
        if(n < 0)
        {
            std::cout << "make pipe error\n";
        }
        else
        {
            std::cout << "make pipe success\n";
        }
    }
    ~NamedPipe()
    {
        unlink(pathName);
        std::cout << "unlink pipe...\n";
    }
};